package com.yunji.hushuang.staticproxy;

import com.yunji.hushuang.common.IHomeworkService;

/**
 * @author hushuang
 * @since 2019/10/14
 */
public class HomeworkProxyServiceImpl implements IHomeworkService {

    private IHomeworkService homeworkService;

    public HomeworkProxyServiceImpl(IHomeworkService homeworkService) {
        this.homeworkService = homeworkService;
    }

    @Override
    public void doHomework() {
        long start = System.currentTimeMillis();
        System.out.println();
        System.out.println("==>>代理哥帮你计算，开始做作业了");

        homeworkService.doHomework();

        long end = System.currentTimeMillis();
        System.out.println(String.format("==>>代理哥帮你计算，你花了 %d ms", end - start));
    }
}
